﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.address.public1
{
	public partial class address :  ModulePage
	{
        protected void Page_Load(object sender, EventArgs e)
        {
            int groupId = (Request.QueryString["group_id"] == null) ? 0 : int.Parse(Request.QueryString["group_id"].ToString());
            this.ViewState["GroupId"] = groupId;
            if (groupId == 0)
            {
                this.ViewState["GroupName"] = "默认";
            }
            else
            {
                DataTable table = new AddressGroupDao().SelectByGroupId(base.Conn, groupId, "");
                if (table.Rows.Count > 0)
                {
                    this.ViewState["GroupName"] = (table.Rows[0]["GroupName"] != DBNull.Value) ? table.Rows[0]["GroupName"].ToString() : "";
                }
                else
                {
                    Response.Write(base.ShowPrompt("无相关分组"));
                    Response.End();
                }
            }
            DataTable table2 = new AddressDao().SelectByGroupId(base.Conn, groupId, "");
            if (table2.Rows.Count > 0)
            {
                this.rptAddress.DataSource = table2;
                this.rptAddress.DataBind();
            }
            else
            {
                this.litMessage.Text = base.ShowMessage("通讯录尚无记录");
            }
        } 

	}
}
